// //头
// const helmet = [
//     "minecraft:diamond_helmet",
//     "minecraft:golden_helmet",
//     "minecraft:iron_helmet",
//     "minecraft:leather_helmet",
//     'minecraft:turtle_helmet',
//     'minecraft:netherite_helmet',
//     'botania:manasteel_helmet',
//     'botania:elementium_helmet',
//     'botania:terrasteel_helmet',
//     'ars_nouveau:novice_hood',
//     'ars_nouveau:apprentice_hood',
//     'ars_nouveau:archmage_hood', 
// ]
// //胸甲
// const chestplate = [
//     "minecraft:diamond_chestplate",
//     "minecraft:golden_chestplate",
//     "minecraft:iron_chestplate",
//     "minecraft:leather_chestplate",
//     'minecraft:netherite_chestplate',
//     'botania:manasteel_chestplate',
//     'botania:elementium_chestplate',
//     'botania:terrasteel_chestplate',
//     'ars_nouveau:novice_robes', 
//     'ars_nouveau:apprentice_robes',
//     'ars_nouveau:archmage_robes',
// ]
// //护腿
// const leggings = [
//     "minecraft:diamond_leggings",
//     "minecraft:golden_leggings",
//     "minecraft:iron_leggings",
//     "minecraft:leather_leggings",
//     'minecraft:netherite_leggings',
//     'botania:manasteel_leggings',
//     'botania:elementium_leggings',
//     'botania:terrasteel_leggings',
//     'ars_nouveau:novice_leggings', 
//     'ars_nouveau:apprentice_leggings',
//     'ars_nouveau:archmage_leggings',
// ]
// //靴子
// const boots = [
//     "minecraft:diamond_boots",
//     "minecraft:golden_boots",
//     "minecraft:iron_boots",
//     "minecraft:leather_boots",
//     'minecraft:netherite_boots',
//     'botania:manasteel_boots',
//     'botania:elementium_boots',
//     'botania:terrasteel_boots',
//     'ars_nouveau:novice_boots',
//     'ars_nouveau:apprentice_boots',
//     'ars_nouveau:archmage_boots',

// ]
// //武器
// const sword = [
//     "minecraft:diamond_sword",
//     "minecraft:golden_sword",
//     "minecraft:iron_sword",
//     "minecraft:stone_sword",
//     'minecraft:trident',
//     'minecraft:netherite_sword',
//     'elementalcraft:staff',
//     'botania:elementium_sword',
//     'botania:manasteel_sword',
//     'botania:terra_sword',
//     'ars_nouveau:enchanters_sword',
//     'tconstruct:sword',
//     'tconstruct:cleaver'
// ]
// //弓
// const bow = [
//     "minecraft:bow",
//     "minecraft:shield",
//     'minecraft:totem_of_undying',
//     'minecraft:crossbow',
//     'botania:crystal_bow',
//     'botania:livingwood_bow',
//     'ars_nouveau:novice_spell_book',
//     'ars_nouveau:apprentice_spell_book',
//     'ars_nouveau:archmage_spell_book',
//     'ars_nouveau:spell_bow',
//     'ars_nouveau:enchanters_shield',
//     'tconstruct:pickaxe'
// ]



// onEvent('entity.spawned',event => {

//     if(event.entity.type == "minecraft:zombie"){

//         if(Math.floor(Math.random() * 100) < 20){
//             let cmd = getSummonCmd(event.entity.x,event.entity.y,event.entity.z,"minecraft:husk");
//             event.server.runCommandSilent(cmd);

//             event.entity.y = -400;
//             event.entity.health = 1;
//         }

//     }
//     if(event.entity.type == "minecraft:skeleton"){
//         if(Math.floor(Math.random() * 100) < 20){
//             let cmd = getSummonCmd(event.entity.x,event.entity.y,event.entity.z,"minecraft:stray");
//             event.server.runCommandSilent(cmd);

//             event.entity.y = -400;
//             event.entity.health = 1;
//         }   
//     }
//     if(event.entity.type == 'minecraft:spider'){
//         if(Math.floor(Math.random() * 100) < 20){
//             let cmd = getSummonCmd(event.entity.x,event.entity.y,event.entity.z,'minecraft:cave_spider');
//             event.server.runCommandSilent(cmd);

//             event.entity.y = -400;
//             event.entity.health = 1;
//         }   
//     }

// });

onEvent('entity.spawned', event => {

    if (event.entity.type == "minecraft:ender_dragon") {
        // event.server.runCommandSilent(`/summon draconicevolution:draconic_guardian ${event.entity.x} ${event.entity.y} ${event.entity.z}`);
        event.server.players.runCommandSilent(`/summon draconicevolution:draconic_guardian 0 80 0`);
        event.server.players.runCommandSilent('/summon draconicevolution:guardian_crystal 0 64 3')
        event.server.players.runCommandSilent('/summon draconicevolution:guardian_crystal 0 64 -3')
        event.server.players.runCommandSilent('/summon draconicevolution:guardian_crystal 3 64 0')
        event.server.players.runCommandSilent('/summon draconicevolution:guardian_crystal -3 64 0')
        event.entity.y = -400;
        event.entity.health = 0;
        event.entity.kill;

    }

    // if (event.entity.type == "atum:villager_male" || event.entity.type == "atum:villager_female") {
    //     let cmd = `/summon minecraft:villager ${event.entity.x} ${event.entity.y} ${event.entity.z} {VillagerData:{profession:"minecraft:nitwit"},Brain:{memories:{job_site:{pos:[I;0,0,0],dimension:"minecraft:overworld"}}}}`
    //     event.entity.y = -400;
    //     event.entity.health = 0;
    //     event.server.players.runCommandSilent(cmd)
    // }
    //summon atum:villager_male
    //summon atum:villager_female
});


// function getSummonCmd(x, y, z, entity) {
//     let randomBoot = boots[Math.floor(Math.random() * boots.length)];
//     let randomLeggings = leggings[Math.floor(Math.random() * leggings.length)];
//     let randomChestplate = chestplate[Math.floor(Math.random() * chestplate.length)];
//     let randomHelmet = helmet[Math.floor(Math.random() * helmet.length)];

//     let randomSword1 = sword[Math.floor(Math.random() * sword.length)];
//     let randomBow = bow[Math.floor(Math.random() * bow.length)];

//     let cmd = "/summon " + entity + " " + x + " " + y + " " + z;
//     cmd += ` {HandItems:[{id:"${randomSword1}",Count:1b},{id:"${randomBow}",Count:1b}],`
//     cmd += `ArmorItems:[{id:"${randomBoot}",Count:1b},{id:"${randomLeggings}",Count:1b},{id:"${randomChestplate}",Count:1b},{id:"${randomHelmet}",Count:1b}],HandDropChances:[0.1f,0.1f],ArmorDropChances:[0.1f,0.1f,0.1f,0.1f]}`;


//     return cmd;
// }
